package com.tz.farmer.enums;

import org.springframework.beans.factory.annotation.Value;

import java.util.HashMap;
import java.util.Map;

public enum ClassifyEnum {


    /**
     * 错误码
     */
    CLASSIFY_V("蔬菜", "蔬菜"),
    CLASSIFY_D("豆制品", "豆制品"),
    CLASSIFY_G("果品", "果品"),
    CLASSIFY_J("食用菌", "食用菌"),
    CLASSIFY_T("调味品", "调味品"),
    CLASSIFY_R("乳品及其乳制品", "乳品及其乳制品"),
    CLASSIFY_S("水产品", "水产品"),
    CLASSIFY_L("粮食及其制品", "粮食及其制品"),
    CLASSIFY_C("茶类", "茶类"),
    CLASSIFY_RQD("肉禽蛋", "肉禽蛋")



    ;
    /**
     * 错误码
     */
    private String code;

    /**
     * 错误消息
     */
    private String message;

    ClassifyEnum(String code, String message) {
        this.message = message;
        this.code = code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public static String getMessage(String code) {
        for (ClassifyEnum e : values()) {
            if (e.getCode() == code) {
                return e.getMessage();
            }
        }
        return "";
    }

    public static final Map<String, String> map = new HashMap();

    static {
        for (ClassifyEnum tEnum : ClassifyEnum.values()) {
            map.put(tEnum.getCode(), tEnum.getMessage());
        }
    }

}
